//
//  UIView+Extension.swift
//  01sinablog
//
//  Created by ZhangZiang on 15/12/23.
//  Copyright © 2015年 ZhangZiang. All rights reserved.
//

import UIKit

extension UIView {
    
    //响应者链 不断找直到父类是 navigationController为止
    func navController() -> UINavigationController? {
        var next = nextResponder()
        //遍历响应者链条
        repeat {
        if let nextObj = next as? UINavigationController {
        
        return nextObj
        
        }
        //获取下下一个响应者
        next = next?.nextResponder()
        
        } while(next != nil)
        
        return nil
    }
}